package com.frost500.orderservice.controller;

import com.frost500.orderservice.service.OrderService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 *
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PutMapping("/{id}/createUnlock")
    public ResponseEntity<Void> createUnlock(@PathVariable("id") Long id){
        orderService.createUnlock(id);
        return ResponseEntity.noContent().build();
    }

    @PutMapping("/{id}/createLocked")
    public ResponseEntity<Void> createLocked(@PathVariable("id") Long id){
        orderService.createLocked(id);
        return ResponseEntity.noContent().build();
    }

    @PutMapping("/{id}/createDistributeLocked")
    public ResponseEntity<Void> createDistributeLocked(@PathVariable("id") Long id){
        orderService.createDistributeLocked(id);
        return ResponseEntity.noContent().build();
    }

    @PutMapping("/insertStorage")
    public ResponseEntity<Void> insertStorage(){
        orderService.insertStorage();
        return ResponseEntity.noContent().build();
    }
    @PutMapping("/insertStorageLocked")
    public ResponseEntity<Void> insertStorageLocked(){
        orderService.insertStorageLocked();
        return ResponseEntity.noContent().build();
    }
    @PutMapping("/insertStorageDistributeLocked")
    public ResponseEntity<Void> insertStorageDistributeLocked(){
        orderService.insertStorageDistributeLocked();
        return ResponseEntity.noContent().build();
    }

}
